<template>
	<view class="im-item-box">
		<!-- 时间开始 -->
		<view class="im-time" v-if="itemText.datetime">
			{{itemText.datetime}}
		</view>
		<!-- 时间结束 -->
		<view :class="itemText.self_side ? 'im-item im-right' : 'im-item im-left'">
			<view class="photo">
				<image :src="itemText.avatar"></image>
			</view>
			<view class="msg msg-bg-2">{{itemText.message}}</view>
			<view v-if="itemText.self_side == 1" :class="itemText.readed == 1 ?  'is-read read' : 'is-read service'">{{itemText.readed == 1 ? '已读' : '送达'}}</view>
		</view>
		<!-- <view class="greet-set-up-box">
			<view class="greet-set-up">打招呼设置></view>
		</view> -->
	</view>
</template>
<script>
	import {
		parseTime,
		formatTime
	} from '@/utils/index.js'
	export default {
		name: 'ItemText',
		props: ['itemText'],
		data() {
			return {

			}
		},
		filters: {
			timeFilter(timestamp) {
				return formatTime(timestamp, '{y}-{m}-{d}', true)
			},
			interviewTimeFilter(timestamp) {
				return parseTime(timestamp, '{y}-{m}-{d} {h}:{i}')
			}
		},
		created() {}
	}
</script>
<style lang="scss" scoped>
	//聊天记录开始

	.msg {
		max-width: 450rpx;
		padding: 24rpx 30rpx;
		word-wrap: break-word;
		font-size: 28rpx;
	}

	.msg-bg-1 {
		background: #5691FF;
		color: #fff;
		border-radius: 20rpx 0px 20rpx 20rpx;
		font-size: 28rpx;
	}

	.msg-bg-2 {
		background: #fff;
		color: #333333;
		border-radius: 0px 20rpx 20rpx 20rpx;
		font-size: 28rpx;
	}

	.msg-img {
		width: 240rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.greet-set-up-box {
		text-align: right;
		font-size: 0;

		.greet-set-up {
			// 打招呼设置
			width: 200rpx;
			height: 60rpx;
			background: #E9E9E9;
			border-radius: 6rpx;
			color: #5691FF;
			font-size: 28rpx;
			text-align: center;
			line-height: 60rpx;
			display: inline-block;
			margin-top: 22rpx;
			margin-right: 140rpx;
		}
	}

	//聊天记录结束
</style>
